package mvc.controllers.app
{
	import alternativa.gui.enum.Align;
	import alternativa.gui.keyboard.KeyboardManager;
	import alternativa.gui.layout.LayoutManager;
	import alternativa.gui.mouse.CursorManager;
	import alternativa.gui.mouse.MouseManager;
	import alternativa.gui.theme.defaulttheme.controls.text.TextInput;
	import alternativa.gui.theme.defaulttheme.init.DefaultTheme;
	import alternativa.gui.theme.defaulttheme.primitives.base.Hint;
	import alternativa.gui.theme.defaulttheme.skin.Cursors;
	import alternativa.init.GUI;
	
	import flash.display.Stage;
	import flash.display.StageAlign;
	import flash.display.StageQuality;
	import flash.display.StageScaleMode;
	import flash.system.Security;
	
	import globals.Global;
	
	import mvc.Notifications;
	import mvc.models.proxys.AppMainProxy;
	import mvc.views.AppMainView;
	
	import org.puremvc.as3.interfaces.INotification;
	import org.puremvc.as3.patterns.command.SimpleCommand;
	
	import xl.utils.Tracker;

	public class StartUpCommand extends SimpleCommand
	{
		public function StartUpCommand()
		{
			super();
		}
		
		override public function execute(notification:INotification):void
		{
			var mApp:SRWeb = notification.getBody()["app"] as SRWeb;
			var mAppView:AppMainView = notification.getBody()["appView"] as AppMainView;
			
			//register proxy;
			facade.registerProxy(new AppMainProxy());
			
			var stage:Stage = mApp.stage;
			stage.align = StageAlign.TOP_LEFT;
			stage.scaleMode = StageScaleMode.NO_SCALE;
			stage.stageFocusRect = false;
			stage.quality = StageQuality.HIGH;
			mAppView.mouseEnabled=false;		//啃爹,一定要加上这句,不然拖动不能正常使用
			mAppView.tabEnabled=false;
			mAppView.init();
			
			//initGUI();
			// AlternativaGUIDefaultTheme initialization
			DefaultTheme.init();
			
			// AlternativaGUI initialization
			GUI.init(stage);
			GUI.hideLogo();
			
			
			// LayoutManager initialization
			LayoutManager.init(stage,[mAppView.guiObjectLayer,mAppView.guiMouseHintLayer]);
			
			// Add hint class to the MouseManager
			MouseManager.setHintImaging(mAppView.guiMouseHintLayer, new Hint());
			
			//初始化鼠标
			//KeyboardManager.init(mAppView.guiObjectLayer);
			
			// CursorManager initialization
			CursorManager.init(Cursors.createCursors());
			
			
			Tracker.log("start up......");
			//notify finishing the init;
			sendNotification(Notifications.APP_STARTUP_OVER,notification.getBody());
			

		}
	}
}